<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<script src="js/mui.min.js"></script>
		<link href="css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="css/register.css"/>
		<link rel="stylesheet" type="text/css" href="css/public.css"/>
		<script type="text/javascript" charset="utf-8">
			mui.init();
		</script>
		<style type="text/css">
			.mui-content{margin-top: 45px;}
		</style>
	</head>

	<body>
	<!--------头部返回收货地址----------->
		<div id="headerNav"></div>
	<!--------填写登录内容----------->
		<div class="mui-content" style="background:white;">
		    
		</div>
	<!--------确认登录----------->
			<div class="mui-button-row" style="background:white;margin-top:22px;">
				<button type="button" class="mui-btn mui-btn-primary" style="width:93%;height:50px;background:#5763FF;position: fixed;left:12px;bottom:12px;" id="btn">新增收货地址</button>
			</div>
	</body>
	<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
	<script type="text/javascript">
		$('#headerNav').load('header.html',function(){
			$('header h1').html('我的收货地址');
		});
	</script>
	<script type="text/javascript">
		var a = localStorage.state;
		var b = localStorage.data;
//		我的地址接口
		$.ajax({
			type:"post",
			url:"http://mall.itcn99.com/i/index/mine_address",
			async:true,
			dataType:'jsonp',
			data:{
				"uid":b,
			},
			success:function(data){
				console.log(data)
				var state = data.state
				var str = "";
				if(state == 0){
					mui.alert("","地址为空，请先添加地址")
				}else if(state == 1){
					for(i=0;i<data.data.length;i++){
						str+='<div class="mui-row"><div class="mui-col-sm-9 mui-col-xs-9" style="padding-left: 15px;"><input type="text" readonly name="name" id="name" value="'+ data.data[i].name+'" style="border:none;padding: 0;margin:0;"/></div><div class="mui-col-sm-3 mui-col-xs-3" style="text-align: right;padding: 15px;"><span style="margin-right:4px;color:#EEEEEE;">|</span><a class="amend" style="color:#5763FF;font-size: 16px;" href="my_site.html?id='+data.data[i].id+'">编辑</a></div></div><div class="mui-row"><input type="text" readonly name="name" id="name" value="'+data.data[i].mobile+'" style="border:none;padding-left:15px;margin:0;font-size: 16px;padding-top:0 ;"/></div><div class="mui-row"><input type="text" readonly name="name" id="name" value="'+data.data[i].address+'" style="border:none;padding-left:15px;margin:0;border-bottom: 1px solid #c8c7cc;font-size: 16px;"/></div>'
						
					}
					$(".mui-content").append(str);	

				}
				$()
			}
		});
		$("#btn").click(function(){
			window.location.href="add_site.html";
		})
			
	</script>
</html>